﻿using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class Battle : MonoBehaviour {

    UILabel log;
    // Use this for initialization
    void Start() {
        UIUtil.setListener("BtnBack", onclick);
        UIUtil.setListener("Btn1", onclick);
        UIUtil.setListener("Btn2", onclick);
        UIUtil.setListener("Btn3", onclick);
        UIUtil.setListener("Btn4", onclick);
        UIUtil.setListener("Btn5", onclick);
        UIUtil.setListener("Btn6", onclick);
        UIUtil.setListener("Btn7", onclick);
        UIUtil.setListener("Btn8", onclick);
        log = transform.Find("log").gameObject.GetComponentInChildren<UILabel>();
    }

    private string text="" ;
    public void onclick(GameObject o) {
        switch(o.name) {
            case "BtnBack":
                SceneManager.LoadScene("ScenceLobby");
                break;
            default:
                if(text.Length > 30) {
                    text = text.Substring(15);
                }
                text += o.transform.Find("Label").GetComponent<UILabel>().text + "\n";

                log.text = text;
                break;
        }
       
    }
    // Update is called once per frame
    void Update() {
        
    }

}
